<?php

namespace common\models\datas;


use Yii;

/**
 * This is the model class for table "{{%wechat_auth}}".
 *
 * @property integer $id
 * @property string $source
 * @property string $source_id
 * @property integer $user_id
 */
class LoginAuth extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%login_auth}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_id','mode'], 'integer'],
            [['source'], 'string', 'max' => 50],
            [['source_id'], 'string', 'max' => 200],
            [['web_site_id'], 'string'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('common', '自动编号'),
            'source' => Yii::t('common', 'Source'),
            'source_id' => Yii::t('common', 'Source ID'),
            'user_id' => Yii::t('common', '自动编号'),
            'web_site_id' => Yii::t('common', '分店id'),
            'mode' => Yii::t('common','类型（1共同体 2综合体 3管弦乐）')
        ];
    }

    public function getUser()
    {
        return $this->hasOne(Customer::className(), ['id' => 'user_id']);
    }

}
